package com.jsyl.lwbk.web.controller.business;

import com.jsyl.lwbk.business.domain.BasicInformation;
import com.jsyl.lwbk.business.service.IChildInformationService;
import com.jsyl.lwbk.business.vo.BasicInformationVO;
import com.jsyl.lwbk.common.core.controller.BaseController;
import com.jsyl.lwbk.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

@Api(value = "小孩信息")
@Controller
@RequestMapping("/business/childInformation")
public class ChildInformationController extends BaseController {

    private String prefix = "business/childEvaluate";

    @Autowired
    IChildInformationService childInformationService;

    @ApiOperation(value = "获取小孩信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "childId", value = "小孩id")})
    @RequiresPermissions("business:childInformation:view")
    @GetMapping("/getInformation/{childId}")
    public String getInformation(@PathVariable("childId") Long childId, ModelMap modelMap) {
        BasicInformationVO basicInformation = childInformationService.getInformation(childId);
        modelMap.put("basicInformation", basicInformation);
        modelMap.put("childId", childId);
        return prefix + "/baseInformation";
    }

    @ApiOperation(value = "保存信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id"),
            @ApiImplicitParam(name = "childId", value = "小孩id"),
            @ApiImplicitParam(name = "parentName", value = "家长姓名"),
            @ApiImplicitParam(name = "parentPhone", value = "家长电话"),
            @ApiImplicitParam(name = "parentAge", value = "家长年龄"),
            @ApiImplicitParam(name = "parentJob", value = "家长工作"),
            @ApiImplicitParam(name = "childName", value = "小孩姓名"),
            @ApiImplicitParam(name = "childAge", value = "小孩年龄"),
            @ApiImplicitParam(name = "childSex", value = "小孩性别"),
            @ApiImplicitParam(name = "learnSituation", value = "就学情况"),
            @ApiImplicitParam(name = "learnSituationRemark", value = "就学情况 其他选项备注"),
            @ApiImplicitParam(name = "familySort", value = "家庭排序"),
            @ApiImplicitParam(name = "mainLanguage", value = "主要语言"),
            @ApiImplicitParam(name = "mainLanguageRemark", value = "主要语言 其他选项备注"),
            @ApiImplicitParam(name = "medicalDiagnosis", value = "医学诊断"),
            @ApiImplicitParam(name = "medicalDiagnosisRemark", value = "医学诊断 其他选项 备注"),
            @ApiImplicitParam(name = "familyHereditaryDisease", value = "家族遗传病"),
            @ApiImplicitParam(name = "hereditaryDiseaseRemark", value = "家族遗传病 其他选项备注"),
            @ApiImplicitParam(name = "pregnantSituation", value = "孕早、中、晚期是否出现特殊情况"),
            @ApiImplicitParam(name = "pregnantMedicine", value = "孕期服药"),
            @ApiImplicitParam(name = "pregnantSituationRemark", value = "孕早、中、晚期特殊情况 其他选项备注"),
            @ApiImplicitParam(name = "abnormalThyroidFunction", value = "甲状腺功能异常"),
            @ApiImplicitParam(name = "pregnantEmotion", value = "孕期情绪状态"),
            @ApiImplicitParam(name = "pregnantEmotionRemark", value = "孕期情绪状态 其他选项备注"),
            @ApiImplicitParam(name = "productionMethod", value = "生产方式"),
            @ApiImplicitParam(name = "productionSpecialSituation", value = "生产期间特殊情况"),
            @ApiImplicitParam(name = "afterProductionSituation", value = "产后情况"),
            @ApiImplicitParam(name = "afterProductionRemark", value = "产后情况   其他选项备注"),
            @ApiImplicitParam(name = "mainCaregiver", value = "主要照料者"),
            @ApiImplicitParam(name = "accidentPhysicalInjury", value = "意外身体伤害"),
            @ApiImplicitParam(name = "physicalInjuryRemark", value = "意外身体伤害   其他选项备注"),
            @ApiImplicitParam(name = "accidentFamilyChanges", value = "意外家庭变动"),
            @ApiImplicitParam(name = "familyChangesRemark", value = "意外家庭变动 其他备注"),
            @ApiImplicitParam(name = "oneTypeVaccines", value = "一类疫苗"),
            @ApiImplicitParam(name = "twoTypeVaccines", value = "二类疫苗"),
            @ApiImplicitParam(name = "otherVaccines", value = "其他疫苗"),
            @ApiImplicitParam(name = "foodAllergy", value = "食物过敏"),
            @ApiImplicitParam(name = "foodAllergyRemark", value = "食物过敏 其他选项 备注"),
            @ApiImplicitParam(name = "breathAllergy", value = "吸入性过敏"),
            @ApiImplicitParam(name = "breathAllergyRemark", value = "呼吸性过敏  其他选项备注"),
            @ApiImplicitParam(name = "contactAllergy", value = "接触性过敏"),
            @ApiImplicitParam(name = "contactAllergyRemark", value = "接触性过敏 其他选项 备注"),
            @ApiImplicitParam(name = "limbDeletion", value = "肢体缺失"),
            @ApiImplicitParam(name = "limbDeletionRemark", value = "肢体缺失 其他选项 备注"),
            @ApiImplicitParam(name = "medicalExamination", value = "医学检查"),
            @ApiImplicitParam(name = "medicalExaminationRemark", value = "医学检查 其他选项 备注"),
            @ApiImplicitParam(name = "path", value = "文件路径")
    })
    @PostMapping("/saveInformation")
    @ResponseBody
    public AjaxResult saveInformation(BasicInformation basicInformation) {
        return toAjax(childInformationService.saveInformation(basicInformation));
    }

}
